package com.business.exam.controller;

import com.business.common.core.domain.AjaxResult;
import com.business.exam.service.IIndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * IndexController 首页数据对接
 * @author liuyq
 * @version 2023/12/14 11:02
**/
@RestController("AdminIndexController")
@RequestMapping(value = "/api/admin/index")
public class IndexController {
    @Autowired
    private IIndexService service;

    /**
     * 首页-统计总览，查询考试场数、题库数量、试题总数
     * @param
     * @return
     */
    @RequestMapping(value = "/selectStatisticsOverview", method = RequestMethod.POST)
    public AjaxResult selectStatisticsOverview() {
        List<Map<String, Object>> list = service.selectStatisticsOverview();
        return AjaxResult.success(list);
    }

    /**
     * 首页-进行中的考试
     * @param
     * @return
     */
    @RequestMapping(value = "/selectOngoingExams", method = RequestMethod.POST)
    public AjaxResult selectOngoingExams() {
        List<Map<String, Object>> list = service.selectOngoingExams();
        return AjaxResult.success(list);
    }

    /**
     * 首页-考试总览
     * @param
     * @return
     */
    @RequestMapping(value = "/selectExamOverview", method = RequestMethod.POST)
    public AjaxResult selectExamOverview() {
        Map<String, Object> map = service.selectExamOverview();
        return AjaxResult.success(map);
    }
}
